/**
 * 业务逻辑公共服务方法.
 */
import $_fn from '~plugins' 
class _Fun {
    constructor($rootScope,$location,$timeout,$interval) {
        this.$rootScope = $rootScope,
        this.$location = $location,
        this.$timeout  = $timeout,
        this.$interval = $interval
    }
    loadScript (path,callback){
		var oHead = document.getElementsByTagName('head')[0];
		if(oHead)
		{
			var oScript = document.createElement('script');
			oScript.setAttribute('src',path);
			oScript.setAttribute('type','text/javascript');
			oScript.setAttribute('charset','utf-8');
			oScript.onreadystatechange = function()
			{
				if (this.readyState == 'complete' || this.readyState == 'loaded')
				{
					callback();
				}
			};
			oScript.onload = callback;
			oHead.appendChild(oScript);
		}
	}
}
_Fun.$injecter = ['$rootScope','$location','$timeout','$interval']
export default angular.module('app.fun', [])
    .service('fun', _Fun)
    .name
